package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.entity.Logs;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface LogsMapper extends BaseMapper<Logs> {
    //过期时更新数据库
    @Update("update  logs set level = #{level} where project_id=#{projectId} and status=#{status}")
    public void updateLevel(Long projectId,int status,int level);

    //获取某日志
    @Select("select * from logs where project_id=#{projectId} and status=#{status} ")
    public Logs getLogs(Long projectId ,int status);

    //更新延期的信息
    @Update("update logs set error_msg =#{extensionMsg} where project_id=#{projectId} and status=#{status}")
    public void changeMsg(String extensionMsg,Long projectId,int status);

    //更新更改人信息
    @Update("update logs set user_id =#{userId} where project_id=#{projectId} and status=#{status}")
    public void changeUserId(Long projectId,int status,Long userId);

    //教师修改项目状态
    @Update("update logs set level=0 where project_id=#{projectId} and status=#{status}")
    public void updateStatusWithLevel(Long projectId,int status);

    //教师修改大创日志时更新状态
    @Update("update logs set level=#{level} where project_id=#{projectId} and status=#{status}")
    public void updateLogsWithLevel(Long projectId,int status,int level);


}
